{% extends 'base.html' %}

<!-- 格言 -->
{% block maxims %}
{% if maxim %}
    {{maxim.words}}
{% else %}
    失败是成功之母。
{% endif %}
{% endblock %}

<!-- 页面主要标签设置 -->
{% block pageSetting %}"indexPage"{% endblock %}


<!-- 次导航条部分用于分类导航 -->
{% block category %}
{% if category %}
    {% for c in category %}
        <li><a href="?category={{c.id}}">{{ c.category }}</a></li>
    {% endfor %}
{% else %}
    <li class="subNavList_1"><a href="#">Blog</a></li>
    <li class="subNavList_2"><a href="#">技术</a></li>
    <li class="subNavList_3"><a href="#">Software</a></li>
    <li class="subNavList_4"><a href="#">Online tools</a></li>
{% endif %}
{% endblock %}

<!-- 内容部分 -->
{% block content %}
<h3>Latest Entry Blog</h3>
{% if latestEntry %}
    {% for entry in latestEntry %}
    <div id="listBlog">
    <h3><a href="/blog/{{entry.id}}/showblog/">{{ entry.title }}</a></h3>
        {{ entry.content|escape|linebreaks|slice:":1000"}}
    <br/>
    <!-- 显示照片 -->
    {% for photo in entry.blogimage_set.all %}
        <img src="/upload_media/{{photo.image}}" class="" alt=""/>
	{{photo.detail|escape|linebreaks}}
    {% endfor %}
    <!-- /显示照片 -->
    
    <br/>
    <p id="blogDetail">{{ entry.pub_date.date }} | <a href="/blog/{{entry.id}}/showblog/">{{entry.comment_set.count}}
    Comments</a> | <a href="/blog/{{entry.id}}/showblog/">Read More<a></p>
    </div>
    <div style="border-bottom:1px dotted #999"></div>
    {% endfor %}
{% else %}
    <p>No data....</p>
{% endif %}
<br/>
<!-- 分页显示部分 -->
{% if is_paginator %}
<div id="page">
  <span class="pageDetail">Page {{cur_page}} of {{end_page}}</span>
  {% if has_previous %}
      <span class="pageLink"><a href="?page={{previous_page}}">&laquo;</a></span>
  {% endif %}
  {% for page in page_range %}
      {% ifequal cur_page page %}
          <span class="selectedPage">{{page}}</span>
      {% else %}
          <span class="pageLink"><a href="?page={{page}}">{{ page }}</a></span>
      {% endifequal %}
  {% endfor %}
  {% if has_next %}
      <span class="pageLink"><a href="?page={{next_page}}">&raquo;</a></span>
  {% endif %}
</div>
{% endif %}
<br/>
{% endblock  %}

<!-- 照片 -->
{% block photourl %}{{randImage}}{% endblock %}
{% block photo %}{{randImage}}{% endblock %}

<!-- 导航条部分 -->

<!-- 最新添加 -->
{% block latestPost %}
<h3>最近添加</h3>
<ul>
  {% if latestEntry %}
      {% for entry in navLatestEntry %}
      <li><a href="/blog/{{entry.id}}/showblog/">{{ entry.title|slice:":15"}}...</a></li>
      {% endfor %}
  {% else %}
      <li>最近没有添加项</li>
  {% endif %}
</ul>
{% endblock %}

<!-- 最新评论 -->
{% block comments %}
<h3>最新评论</h3>
<ul>
  {% if comments %}
      {% for c in comments %}
          <li><span class="peopleName">{{ c.name }}:</span><a href="/blog/{{c.blog_id}}/showblog">{{ c.comment|slice:":20"}}</a></li>
      {% endfor %}
  {% else %}
	  <li><a href="#">没有评论</a></li>
  {% endif %}
</ul>

{% endblock %}

<!-- 分类收藏 -->
{% block subCategory %}
<h3>分类收藏</h3>
<ul>
{% if category %}
    {% for c in category %}
        <li><a href="?category={{c.id}}">{{ c.category }} ({{ c.blog_set.count }})</a></li>
    {% endfor %}
{% else %}
    <li class="subNavList_1"><a href="#">Blog</a></li>
    <li class="subNavList_2"><a href="#">技术</a></li>
    <li class="subNavList_3"><a href="#">Software</a></li>
    <li class="subNavList_4"><a href="#">Online tools</a></li>
{% endif %}
</ul>
{% endblock %}

<!-- 我的链接 -->
{% block myLink %}
<h3>我的链接</h3>
<ul>
  {% if links %}
      {% for link in links %}
          <li><a href="http://{{link.address}}">{{link.link_name}}</a></li>
      {% endfor %}
  {% endif %}
</ul>

{% endblock %}
